/* Arexx macro to put HTML tag, that is passed from the command line as argument, around
currently selected block or current line (if no block is selected)
Written on 08/17/96 by Oleg Moskalensky
Last Modified on 09/15/96 by Oleg Moskalensky
Copyright © 1996 - Productive Computer Systems
ALL RIGHTS RESERVED
*/
/* trace ?R */
OPTIONS RESULTS
ARG Tag
address "TURBOTEXT0"
StartTag = "<" || Tag || ">"
EndTag = "" || Tag || ">"
if Tag = "BR" then
do
insert "
"
return
end
if Tag = "HR" then
do
EndTag = ""
'RequestStr PROMPT "Enter Width" "100%"'
Width = RESULT
if RC = 0 & Width ~= "100%" then StartTag = "
" when Alignment = 2 then StartTag = "
" when Alignment = 3 then StartTag = "
"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
if Tag = "IMG" then
do
'RequestFile PROMPT "Please select an IMAGE file"'
if RC = 0 then
do
Imagename = RESULT
text ''
'ActivateWindow'
RETURN
end
end
if Tag = "MAIL" then
do
'RequestStr PROMPT "Enter a valid e-mail address" "pcs@accessone.com"'
email = RESULT
if RC = 0 then
do
StartTag = ''
EndTag = ''
end
else
do
'ActivateWindow'
RETURN
end
end
if Tag = "FONTSIZE" then
do
'RequestChoice "Font Size" "Select FONT adjustment amount" "-3|-2|-1|+1|+2|+3|Cancel"'
FontVariation = RESULT
select
when FontVariation = 1 then StartTag = ""
when FontVariation = 2 then StartTag = ""
when FontVariation = 3 then StartTag = ""
when FontVariation = 4 then StartTag = ""
when FontVariation = 5 then StartTag = ""
when FontVariation = 6 then StartTag = ""
otherwise
do
'ActivateWindow'
RETURN
end
end
EndTag = ""
end
if Tag = "FONTCOLOR" then
do
'RequestChoice "Font Color" "Select predefined or your own color" "Black|White|Red|Green|Blue|CHOOSE|Cancel"'
FontColor = RESULT
select
when FontColor = 1 then StartTag = ''
when FontColor = 2 then StartTag = ''
when FontColor = 3 then StartTag = ''
when FontColor = 4 then StartTag = ''
when FontColor = 5 then StartTag = ''
when FontColor = 6 then
do
'RequestStr PROMPT "Enter color as a 6-digit RGB number (default: yellow)" "FFFF00"'
Color = RESULT
if RC ~= 0 then
do
'ActivateWindow'
'MarkBlk'
RETURN
end
else StartTag = ''
end
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
EndTag = ""
end
if Tag = "UL" then
do
'RequestChoice "Non-numbered List" "Select character style" "Bullet|Square|Circle|Cancel"'
Style = RESULT
select
when Style = 1 then ListType = ""
when Style = 2 then ListType = "TYPE=SQUARE"
when Style = 3 then ListType = "TYPE=CIRCLE"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
if Tag = "OL" then
do
'RequestChoice "Numbered List" "Select numbering style" "1|I|A|a|Cancel"'
Style = RESULT
select
when Style = 1 then ListType = "TYPE=1"
when Style = 2 then ListType = "TYPE=I"
when Style = 3 then ListType = "TYPE=A"
when Style = 4 then ListType = "TYPE=a"
otherwise
do
'ActivateWindow'
'MarkBlk'
RETURN
end
end
end
do
getblkinfo
parse var RESULT SelectedBlock dummy BeginRow BeginCol
if SelectedBlock = "ON" then
do
getcursorpos
parse var RESULT EndRow EndCol dummy
if (Tag = "UL" | Tag = "OL") then
do
move BeginRow 1
insert "<" || Tag || " " || ListType || ">"
'InsertLine'
BeginRow = BeginRow + 1
EndRow = EndRow + 1
call InsertLI
move EndRow 1
if (EndCol = 1) then
do
text "" || Tag || ">"
insertline
end
else
do
moveeol
insertline
text "" || Tag || ">"
end
'MarkBlk'
'ActivateWindow'
RETURN
end
move BeginRow BeginCol
insert StartTag
if BeginRow = EndRow then
move EndRow (EndCol + length(StartTag))
else
move EndRow EndCol
insert EndTag
'MarkBlk'
'ActivateWindow'
end
else
do
movesol
text StartTag
moveeol
text EndTag
'ActivateWindow'
end
end
exit 0
InsertLI:
do Row = BeginRow to (EndRow - ((EndCol=1) * 1))
move Row 1
text "